
console.log("common")
// 课后自己研究
// 解析浏览器的 url 
function urlParse(){
    var search = location.search;
    var str = search.substring(1) ;  // 字符串裁剪 去掉  ?  ?goodsId=33891465727&id=222 = goodsId=33891465727&id=222
    var list = str.split("&"); // goodsId=33891465727&id=222 =>  ['goodsId=33891465727','id=222']

    var data = {}
    for(var i =0;i<list.length;i++){
        var item = list[i]     // goodsId=33891465727
        var key = item.split("=")[0]  // goodsId id
        var value = item.split("=")[1] // 33891465727   222

        data[key] = decodeURIComponent(value)  // url中可能有中文和特殊的字符 需要解码 
    }

    return data ;
}
